#pragma once

#include "MGUI_Widget.h"
#include "MGUI_LookFeel.h"
#include "MGUI_RenderItem.h"
#include "MGUI_Serializer.h"

namespace Myway {

	class MGUI_ENTRY MGUI_Layout : public MGUI_Widget
	{
		DeclareRTTI();

	public:
		MGUI_Layout(const MGUI_LookFeel * _lookfeel, MGUI_Widget * _parent = NULL);
		virtual ~MGUI_Layout();

		MGUI_RenderItem * GetRenderItem(int _order, Texture * _skin);

		void UpdateRenderItem();
		void DoRender();

	protected:
		List<MGUI_RenderItem *> mRenderItems;
	};


	class MGUI_ENTRY MGUI_LayoutLoader
	{
	public:
		static MGUI_Layout * Load(const char * source, MGUI_Widget * parent);
		static MGUI_Layout * Load(DataStreamPtr stream, MGUI_Widget * parent);

	protected:
		static void _loadWidget(MGUI_Widget * _widget, xml_node * _node);
	};
}